package com.wanxi.servlet;

import com.wanxi.model.ProductModel;
import com.wanxi.service.ProductService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/product")
public class ProductServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        CommonServlet.getCompanyData(req, resp);

        ProductService productService = new ProductService();
        List<ProductModel> productModelList = productService.getListForProduct();
        req.setAttribute("productModelList", productModelList);


        req.getRequestDispatcher("/jsp/product.jsp").forward(req, resp);
    }
}
